﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Frame.Lib.Core.Dept;
using Frame.Lib.Utilities;
using Frame.Lib.Core.User;

public partial class Admin_User_Move : PageSelectTree
{
    private DeptBO Dept
    {
        get
        {
            return DeptBO.Instance<DeptBO>();
        }
    }

   

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {            
            BindTree();
        }
        tvList.Attributes.Add("onclick", "SingleSelect()");
    }

    private void BindTree()
    {
        Dept.BindTreeView(tvList, true, null);
    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strUserIDs = Request["UserIDs"];
        List<int> userIDs = StrUtil.SplitToInt(strUserIDs);

        List<int> deptIDs = StrUtil.SplitToInt(CheckedIDs);
        if (deptIDs.Count > 0)
        {
            UserBO user = new UserBO();
            user.MoveDept(userIDs, deptIDs.First());
        }
        JSUtil.ResponseJS("close();returnValue=true");
    }  
}
